﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace Wpf2.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow 
    {
        public  StackPanel Main;
        public MainWindow()
        {
            try
            {
                InitializeComponent();
                Main = rootPanel.Children[1] as StackPanel;
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }

        }

        private void BtnHomeClick(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPanel.Children.RemoveAt(1);
                rootPanel.Children.Add(Main);
            }
            catch (Exception ex)
            {
                
                MessageBox.Show(ex.Message);
            }
        }

        private void BtnMenuQuanlykhoClick(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPanel.Children.RemoveAt(1);
                var fQLK = new FormQuanlykho();
                rootPanel.Children.Add(fQLK);
            }
            catch (Exception ex)
            {
                
                MessageBox.Show(ex.Message);
            }
        }

        private void BtnQuanlykhoClick(object sender, RoutedEventArgs e)
        {
            btnMenuQuanlykho.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
        }

        private void BtnNhapKhoClick(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPanel.Children.RemoveAt(1);
                var fAddInve = new AddInventory();
                rootPanel.Children.Add(fAddInve);
            }
            catch (Exception ex)
            {
                
               MessageBox.Show(ex.Message);
            }
        }

        private void BtnOutInventoryClick(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPanel.Children.RemoveAt(1);
                var fOutInve = new OutInventory();
                rootPanel.Children.Add(fOutInve);
            }
            catch (Exception ex)
            {
                
               MessageBox.Show(ex.Message);
            }
        }

        private void BtnOrderManagementClick(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPanel.Children.RemoveAt(1);
                var ucOrMa = new UcOrderManagement();
                rootPanel.Children.Add(ucOrMa);
            }
            catch (Exception ex)
            {
                
                MessageBox.Show(ex.Message);throw;
            }
        }
    }
}
